<h1 class="page_title">VB课程班级管理</h1>
<div class="panel panel-default">
    <div class="panel-header">
        添加班级
    </div>
    <div class="panel-body">
        <form action="" method="post" class="form form-horizontal responsive" id="demoform" novalidate="novalidate">
            <div class="row cl">
                <label class="form-label col-xs-3">班级名称：</label>
                <div class="formControls col-xs-8">
                    <input type="text" class="input-text valid" placeholder="15级信管2班" id="className"
                           autocomplete="off">
                </div>
            </div>
            <div class="row cl">
                <div class="col-xs-8 col-xs-offset-3">
                    <input id="addClassBtn" class="btn btn-primary" type="button" value="&nbsp;&nbsp;添加&nbsp;&nbsp;">
                    <input class="btn btn-danger" type="reset" value="&nbsp;&nbsp;重置&nbsp;&nbsp;">
                </div>
            </div>
        </form>
    </div>
</div>
<script type="text/javascript">
    var className;
    $('#addClassBtn').on('click', function () {

        if ((className = $('#className').val().trim()) === '') {
            alert("班级名称不能为空");
            return;
        }
        stupidAjaxGetJson(
            "/adm/class/add",
            "post",
            {className: className},
            function (res) {
                alert(res.msg);
                if (res.success) {
                    backView();
                }
            }
        );
    });
</script>